package com.nulldev.util.networking.async2.tcp.client.exceptions;

import com.nulldev.util.networking.async2.tcp.client.connectors.TCPConnector;
import com.nulldev.util.networking.async2.tcp.client.packets.OutgoingTCPClientPacket;

public final class ConnectorCannotSendPacketException extends Exception {

	private static final long serialVersionUID = 2638232415004722373L;
	private final TCPConnector fConnector;
	private final OutgoingTCPClientPacket fPacket;

	public ConnectorCannotSendPacketException(TCPConnector connector, OutgoingTCPClientPacket packet) {
		super("Connector is disconnected");

		fConnector = connector;
		fPacket = packet;
	}

	/**
	 * Returns the connector was unable to send the packet.
	 *
	 * @return the connector was unable to send the packet.
	 */
	public TCPConnector getConnectorInstance() {
		return fConnector;
	}

	/**
	 * Returns the unsent packet.
	 *
	 * @return the unsent packet.
	 */
	public OutgoingTCPClientPacket getOutgoingPacket() {
		return fPacket;
	}

}